require('./Prelplyitem.styl');
import People from 'images/svg/people.svg'
import { Boxs } from 'saltui'
const { HBox, Box, VBox } = Boxs;
import { Control } from 'react-keeper'
const classNames = require('classnames');
class Prelplyitem extends React.Component {

    constructor(props) {
        super(props);
        this.state = {
            replayId: props.replayId,//用户id
            userType: props.userType,//用户类型
            imgurl: props.imgurl,//图像地址
            name: props.name,//姓名
            replayDate: props.replayDate,//回复时间
            content: props.content, //回复内容
            readStatus:props.readStatus,
            replayType:props.replayType
        };
        this.data = this.props.data;
    }
 
    render() {
        return (
            <div  className={classNames("prelplyitem",{"space":this.props.num==0})}>
                <HBox>
                    <Box >
                        {!this.state.imgurl ? <People width="30" height="30" /> :
                            <img src={this.state.imgurl} width="30" height="30" alt="" />}
                    </Box>
                    <Box flex={3} className="t-ML5">
                        <div><span>{this.state.name}</span><span className='t-ML12'>{this.state.replayDate}</span></div>
                        <p className="t-MT10 content">{this.state.content}</p>
                    </Box>
                </HBox>
            </div>
        );
    }

    componentWillMount() {
    }

    componentDidMount() {

    }

    componentWillReceiveProps(nextProps) {
        this.setState({
            replayId: nextProps.replayId,//用户id
            userType: nextProps.userType,//用户类型
            imgurl: nextProps.imgurl,//图像地址
            name: nextProps.name,//姓名
            replayDate: nextProps.replayDate,//回复时间
            content: nextProps.content, //回复内容
            readStatus: nextProps.readStatus, //0未读 1已读
            replayType:nextProps.replayType
        });
        if (nextProps.data) {
            this.data = nextProps.data;// 存schoolId,noticeId
        }
    }

    shouldComponentUpdate(nextProps, nextState) {
        return true;
    }

    componentWillUpdate(nextProps, nextState) {
    }

    componentDidUpdate(prevProps, prevState) {
    }

    componentWillUnmount() {
    }
}

module.exports = Prelplyitem;
